package com.seafwg.service.impl;

import com.seafwg.dao.AccountMapper;
import com.seafwg.service.AccountService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @Author seafwg
 * @Date 2022/3/23 7:05 下午
 * @Version 1.0
 * @description xxx
 */

@Service
public class AccountServiceImpl implements AccountService {

    @Resource
    private AccountMapper accountMapper;

    @Override
    @Transactional
    public void transfor(String addName, String divName, Integer money) {
        // 增加
        accountMapper.addAccount(addName, money);
        // int a = 10/0;

        // 减少
        accountMapper.divAccount(divName, money);
    }
}
